package edu.udlap.spring2008.is300.finalexam.app.mvc.model.database.filters;

import edu.udlap.spring2008.is300.finalexam.framework.mvc.model.database.filters.ImageRecordFilter;
import edu.udlap.spring2008.is300.finalexam.framework.mvc.model.database.filters.ImageRecordFilterDecorator;
import edu.udlap.spring2008.is300.finalexam.framework.mvc.model.database.objects.SizeRecord;

/**
 *
 * @author Ruslán Ledesma Garza
 */
public class AppImageRecordFilterSize extends ImageRecordFilterDecorator
{
    protected int id_;
    
    public AppImageRecordFilterSize(ImageRecordFilter imageRecordFilter,
            SizeRecord sizeRecord, boolean isNegated)
    {
        decoratedImageRecordFilter_ = imageRecordFilter;
        filterValue_ = sizeRecord;
        isNegated_ = isNegated;
    }

    @Override
    protected String getSqlConstraints_()
    {
        return "\"ID_SIZE\" " + (isNegated_ ? "!" : "") +
                "= " + ((SizeRecord)filterValue_).getId();
    }

}